/*
 * HomePage
 *
 * This is the first thing users see of our App, at the '/' route
 *
 * NOTE: while this component should technically be a stateless functional
 * component (SFC), hot reloading does not currently support SFCs. If hot
 * reloading is not a necessity for you then you can refactor it and remove
 * the linting exception.
 */

import React from 'react';
import HomeContainer from './style';
import TestDemo from './test';


export default class HomePage extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
         date:(new Date()).getTime(),

        };
        this.num = 0;

    }

    componentWillMount () {
         console.log('parent-will');


    }

    componentDidMount () {
        console.log('parent-did');
        this.loop = setInterval(() => {
            this.num += 1;
            //console.log(this.state.num);
            this.setState({
                date:(new Date()).getTime()
            });
        },1000)

    }

    render() {
        console.log('parent-render');
        return (
            <HomeContainer>

                <div className="bc-con">
                </div>
                <div className="wrapper">
                    11111
                    <div>
                        <TestDemo date={this.state.date} num={this.num}/>
                    </div>

                </div>
            </HomeContainer>
        );
    }
    componentWillReceiveProps(nextprops){

        console.log('parent-componentWillReceiveProps');
    }
    shouldComponentUpdate(nextprops,nextState){
        console.log('parent-shouldComponentUpdate');
        return true;
    }
    componentWillUpdate(){
        console.log('parent-componentWillUpdate');
    }
    componentDidUpdate(){
        console.log('parent-componentDidUpdate');
    }
    componentWillUnmount(){
        clearInterval(this.loop);
    }
}
